import Vue from 'vue'
import './plugins/axios'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/vant.js'
import qs from 'qs'
import 'amfe-flexible' // 给根元素设置大小，并且专为Rem
import 'postcss-pxtorem' // 将设置的PX专为Rem
import VueAMap from 'vue-amap'

Vue.use(VueAMap)
VueAMap.initAMapApiLoader({
  key: '823c2c7b8d3d90a7935483b8edc6463e',
  plugin: ['Autocomplete', 'PlaceSearch', 'Scale', 'OverView', 'ToolBar', 'PolyEditor', 'AMap.CircleEditor', 'Geolocation'],
  v: '1.4.5'
})
Vue.config.productionTip = false
Vue.prototype.$qs = qs
// Vue.prototype.VueAMap = VueAMap

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})
